package com.maple.mapper;

import com.maple.entity.User;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

public interface UserMapper {
    /**
     * 新增用户
     * @param user
     */
    void save(User user);

    /**
     * 根据用户的openid查询
     * @param openId
     * @return
     */
    @Select("select * from user where openid = #{openId}")
    User queryByOpenId(String openId);

    /**
     * 根据用户的id进行查询
     * @param userId
     * @return
     */
    @Select("select * from user where id = #{userId}")
    User queryByUserId(Long userId);

    /**
     * 根据时间段进行查询
     * @param begin
     * @param end
     * @return
     */
    Integer getUserCountByTimes(LocalDateTime begin, LocalDateTime end);
}
